<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:76:"D:\phpStudy\WWW\huimei\public/../application/admin\view\goods\good_edit.html";i:1641032310;s:64:"D:\phpStudy\WWW\huimei\application\admin\view\public\header.html";i:1555721965;s:64:"D:\phpStudy\WWW\huimei\application\admin\view\public\footer.html";i:1640513393;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="Shortcut Icon"type="image/x-icon"href="favicon.ico">
    <title><?php echo config('WEB_SITE_TITLE'); ?></title>
    <link href="/static/admin/css/bootstrap.css?v=3.3.7" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.7.0" rel="stylesheet">
    <link href="/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/cropper.min.css" rel="stylesheet">
    <link href="/static/admin/css/ImgCropping.css" rel="stylesheet">
    <link href="/static/admin/css/plugins/footable/footable.core.css" rel="stylesheet">
    <link href="/static/admin/js/plugins/layui/css/layui.css" rel="stylesheet">
    <link href="/static/admin/js/plugins/viewer/viewer.css" rel="stylesheet">
    <link href="/static/admin/js/plugins/zTree/zTreeStyle.css" rel="stylesheet" >
    <link href="/static/admin/js/plugins/formSelects-v4/formSelects-v4.css" rel="stylesheet" >
    <script src="/static/admin/js/Icon.js"></script>
    <link rel="stylesheet" href="/static/admin/js/plugins/wx-audio/wx-audio.css" >
    <link rel="stylesheet" href="/static/admin/js/plugins/webuploader/webuploader.css" ><!--webUploader上传组件-->
    <link rel="stylesheet" href="/static/admin/js/plugins/webuploader/style.css" ><!--webUploader上传组件-->
    <style type="text/css">
    #chooseicon {margin:20px;}
    #chooseicon ul { margin:5px 0 0 0;}
    #chooseicon ul li{width:41px;height:41px;line-height:41px;border:1px solid #e7e7e7;padding:1px;margin:1px;text-align: center;font-size:18px;}
    #chooseicon ul li:hover{border:1px solid #2c3e50;cursor:pointer;}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">名字：</label>
                            <div class="layui-input-block">
                                <input type="text" name="good_name" value="<?php echo $info['good_name']; ?>" lay-verify="required" placeholder="名字" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">缩略图：</label>
                            <input type="hidden" name="good_thumb" id="lay-img" lay-verify="image" value="<?php echo $info['good_thumb']; ?>">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                        <img class="layui-append-img" src="<?php echo $info['good_thumb']; ?>" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <!--大分类品牌和门店 start -->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择分类：</label>
                            <div class="layui-input-block">
                                <select name="good_s_t_id"  lay-search="" lay-filter="types" id="types" lay-verify="required">
                                    <option value="">---- 请选择分类 ----</option>
                                    <?php if(is_array($type1) || $type1 instanceof \think\Collection || $type1 instanceof \think\Paginator): if( count($type1)==0 ) : echo "" ;else: foreach($type1 as $key=>$t): ?>
                                    <option value="<?php echo $t['t_id']; ?>" <?php if($t['t_id'] == $info['good_s_t_id']): ?>selected<?php endif; ?>><?php echo $t['t_name']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择品牌：</label>
                            <div class="layui-input-block">
                                <select name="good_s_pp_id"  lay-search="" lay-filter="pps" id="type_pps" lay-verify="required">
                                    <option value="">---- 请选择品牌 ----</option>
                                    <?php if(is_array($pp1) || $pp1 instanceof \think\Collection || $pp1 instanceof \think\Paginator): if( count($pp1)==0 ) : echo "" ;else: foreach($pp1 as $key=>$t): ?>
                                    <option value="<?php echo $t['pp_id']; ?>" <?php if($t['pp_id'] == $info['good_s_pp_id']): ?>selected<?php endif; ?>><?php echo $t['pp_name']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择门店：</label>
                            <div class="layui-input-block" id="type_sss">
                                <?php if(is_array($stores) || $stores instanceof \think\Collection || $stores instanceof \think\Paginator): $i = 0; $__LIST__ = $stores;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$t): $mod = ($i % 2 );++$i;?>
                                <input type="checkbox" class="inputinput" value="<?php echo $t['s_id']; ?>" name="good_s_id[]" <?php if(in_array($t['s_id'],$info['good_s_id'])): ?>checked<?php endif; ?> title="<?php echo $t['s_name']; ?>" />
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </div>
                        </div>
                        <!--大分类品牌和门店 end -->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">商品分类：</label>
                            <div class="layui-input-block">
                                <select name="good_t_id" lay-search=""  lay-verify="required" id="msg1">
                                    <option value="">请选择商品分类</option>
                                    <?php if(is_array($types) || $types instanceof \think\Collection || $types instanceof \think\Paginator): if( count($types)==0 ) : echo "" ;else: foreach($types as $key=>$v): ?>
                                    <option value="<?php echo $v['st_id']; ?>" <?php if($v['st_id'] == $info['good_t_id']): ?>selected<?php endif; ?>><?php echo $v['st_name']; ?>(<?php echo $v['st_remark']; ?>)</option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">商品品牌：</label>
                            <div class="layui-input-block">
                                <select name="good_pp_id" lay-search=""  lay-verify="required" id="msg2">
                                    <option value="">请选择商品品牌</option>
                                    <?php if(is_array($pps) || $pps instanceof \think\Collection || $pps instanceof \think\Paginator): $i = 0; $__LIST__ = $pps;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$t): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $t['spp_id']; ?>" <?php if($t['spp_id'] == $info['good_pp_id']): ?>selected<?php endif; ?>><?php echo $t['spp_name']; ?>(<?php echo $t['spp_remark']; ?>)</option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">商品风格：</label>
                            <div class="layui-input-block">
                                <select name="good_style_id" lay-search=""  lay-verify="required" id="msg3">
                                    <option value="">请选择商品风格</option>
                                    <?php if(is_array($styles) || $styles instanceof \think\Collection || $styles instanceof \think\Paginator): $i = 0; $__LIST__ = $styles;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$t): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $t['sstyle_id']; ?>" <?php if($t['sstyle_id'] == $info['good_style_id']): ?>selected<?php endif; ?>><?php echo $t['sstyle_name']; ?>(<?php echo $t['sstyle_remark']; ?>)</option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">价格文案：</label>
                            <div class="layui-input-block">
                                <input type="text" name="good_money_name" value="<?php echo $info['good_money_name']; ?>" lay-verify="required" placeholder="价格文案，如：活动价" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">价格：</label>
                            <div class="layui-input-block">
                                <input type="text"  value="<?php echo $info['good_money_min']; ?>" style="width: 100px;display: inline;"
                                       name="good_money_min" placeholder="最低" class="layui-input"
                                       oninput="value=value.replace(/[^\d]/g,'')">
                                —
                                <input type="text" value="<?php echo $info['good_money_max']; ?>" style="width: 100px;display: inline;"
                                       name="good_money_max" placeholder="最高" class="layui-input"
                                       oninput="value=value.replace(/[^\d]/g,'')">
                                &nbsp;&nbsp;填写最小与最大值，单位：元
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">排序值</label>
                            <div class="layui-input-block">
                                <input type="number" placeholder="值越大越靠前" value="<?php echo $info['good_sort']; ?>" name="good_sort" maxlength="11" class="layui-input" lay-verify="number" >
                            </div>
                        </div>
                        <input type="hidden" class="layui-input" value="<?php echo $info['good_id']; ?>" name="good_id" />
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="headCrop" style="display:none">
    <div class="tailoring-content-one">
        <label title="选择图片" for="chooseImg" class="layui-btn" style="font-weight: normal">
            <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg" class="hidden" onchange="selectImg(this)"><i class="fa fa-cloud-upload"></i>
            选择图片
        </label>
    </div>
    <div class="ibox-content">
        <div class="tailoring-content">
            <div class="tailoring-content-two">
                <div class="tailoring-box-parcel" style="text-align: center">
                    <img id="tailoringImg">
                    <span class="word" style="position:relative;top:50%;font-size:14px;color: #c2c2c2">仅支持JPG、JPEG、PNG格式的图片文件</span><br>
                    <!--<span class="size" style="position:relative;top:50%;font-size:16px">文件不能大于2MB</span>-->
                </div>
                <div class="preview-box-parcel">
                    <!--<p>图片预览：</p>-->
                    <div class="square previewImg"></div>
                    <div class="circular previewImg"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <span class="layui-btn cropper-reset-btn" style="float:left">复位</span>
        <span class="layui-btn zoomIn" style="float:left">放大</span>
        <span class="layui-btn zoomOut" style="float:left">缩小</span>
        <span class="layui-btn cropper-rotate-btn" style="float:left">旋转</span>
        <span class="layui-btn cropper-scaleX-btn" style="float:left">换向</span>
        <span class="layui-btn " id="sureCut"><i class="fa fa-save"></i> 保存</span>
        <span class="layui-btn layui-btn-primary" onclick="layer.closeAll()"><i class="fa fa-close"></i> 关闭</span>
    </div>
</div>
<script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/admin/js/bootstrap.js?v=3.3.7"></script>
<script src="/static/admin/js/jquery.form.js"></script>
<script src="/static/admin/js/plugins/layui/layui.js"></script>
<script src="/static/admin/js/wk.js"></script>
<script src="/static/admin/js/cropper.min.js"></script>
<script src="/static/admin/js/plugins/viewer/viewer.js"></script>
<script src="/static/admin/js/common.js"></script>
<script src="/static/admin/js/plugins/webuploader/webuploader.js"></script><!--webUploader上传组件-->
<script src="/static/admin/js/plugins/zTree/jquery.ztree.core-3.5.js"></script>
<script src="/static/admin/js/plugins/zTree/jquery.ztree.excheck-3.5.js"></script>
<!--<script src="/static/admin/js/plugins/zTree/jquery.ztree.exedit-3.5.js"></script>-->
<script src="/static/admin/js/plugins/formSelects-v4/formSelects-v4.js"></script>
<!--<script src="/static/admin/js/plugins/wangEditor-3.1.1/release/wangEditor.js" ></script>-->
<script src="/static/admin/js/plugins/xm-select/xm-select.js"></script>
<script src="https://cdn.jsdelivr.net/npm/wangeditor@latest/dist/wangEditor.min.js" ></script>
<script src="/static/admin/js/plugins/wx-audio/wx-audio.js" ></script>
<script>
    layui.config({
        base: '/src/' //静态资源所在路径
    }).extend({
        index: 'index', //主入口模块
        interact : 'interact'//三级联动
    }).use(['index','interact']),function(){};
</script>
<script>
    //关闭自动填充
    // $('input').attr('autocomplete',"off");

    //view初始化查看图片
    $(function(){
        $('.img-circle').viewer();
    })
</script>
<script>
    //layui三级联动
    layui.use(['form'], function() {
        var form = layui.form
                , layer = layui.layer
        form.on('select(province)', function(data){
            getArea("province",data.value);
        });
        form.on('select(city)', function(data){
            getArea("city",data.value);
        });
        function getArea(type,id){
            $.ajax({
                url:"<?php echo url('admin/Base/place'); ?>",
                dataType:"json",
                data:'id='+id,
                type:'post',
                success:function(res){
                    var opt = '';
                    $.each(res.msg,function(key,vo){
                        opt = opt+"<option value="+vo.district_id+">"+vo.district+"</option>";
                    })
                    if(type=="province"){
                        $("#city").empty();
                        $("#city").append('<option value="">---- 请选择市 ----</option>');
                        $("#district").empty();
                        $("#district").append('<option value="">---- 请选择区 ----</option>');
                        $("#city").append(opt);
                        form.render('select');
                    }else if(type == "city"){
                        $("#district").empty();
                        $("#district").append('<option value="">---- 请选择区 ----</option>');
                        $("#district").append(opt);
                        form.render('select');
                    }
                }
            })
        }
    })
</script>
<script>
    //layui公共操作
    layui.use(['form','table'], function() {
        var form = layui.form
            , layer = layui.layer
            , table = layui.table

        //重置搜索框
        $('#empty').on('click', function () {
            $('.search').val('');
            // $(".search").trigger("chosen:updated");
            $('select').each(function (i, j) {
                $(j).find("option:selected").attr("selected", false);
                form.render('select')
            })
        });
        //表格排序
        table.on('sort(demo)', function(obj){
            table.reload('testReload', {
                initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态
                ,where: { //请求参数
                    field: obj.field //排序字段
                    ,order: obj.type //排序方式
                }
            });
        });
        //监听搜索
        form.on('submit(LAY-search)', function (data) {
            //执行重载
            table.reload('testReload', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: data.field
            });
        });
    });
    //获取serialize数据转对象
    // $.fn.parseForm=function(){
    //     var serializeObj={};
    //     var array=this.serializeArray();
    //     var str=this.serialize();
    //     $(array).each(function(){
    //         if(serializeObj[this.name]){
    //             if($.isArray(serializeObj[this.name])){
    //                 serializeObj[this.name].push(this.value);
    //             }else{
    //                 serializeObj[this.name]=[serializeObj[this.name],this.value];
    //             }
    //         }else{
    //             serializeObj[this.name]=this.value;
    //         }
    //     });
    //     return serializeObj;
    // }
</script>

<script>
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"<?php echo url('Upload/upload'); ?>",domain:""});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"<?php echo url('goodEdit'); ?>",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
        form.on('select(types)', function(data){
            $.ajax({
                url:"<?php echo url('admin/Store/getDatas'); ?>",
                dataType:"json",
                data:'t_id=' + data.value,
                type:'post',
                success:function(res){
                    var opt = '';
                    $.each(res.msg,function(key,vo){
                        opt = opt+"<option value="+vo.pp_id+">"+vo.pp_name+"</option>";
                    });
                    $("#type_pps").empty();
                    $("#type_sss").empty();
                    $("#msg1").empty();
                    $("#msg2").empty();
                    $("#msg3").empty();
                    $("#type_pps").append('<option value="">---- 请选择品牌 ----</option>');
                    $("#type_pps").append(opt);
                    form.render('select');
                }
            })
        });
        form.on('select(pps)', function(data){
            $.ajax({
                url:"<?php echo url('admin/Cases/getDatas2'); ?>",
                dataType:"json",
                data:'pp_id=' + data.value,
                type:'post',
                success:function(res){

                    var opt = '';
                    $.each(res.msg,function(key,vo){
//                        opt = opt+"<option value="+vo.s_id+">"+vo.s_name+"</option>";
                        opt = opt+"<input type='checkbox' class='inputinput' value="+vo.s_id+" name='good_s_id[]'  title="+vo.s_name+" />";
                    });
                    $("#type_sss").empty();
                    $("#type_sss").append(opt);
//                    form.render('select');
                    form.render('checkbox');
                    //11
                    var opt = '';
                    $.each(res.msg1,function(key,vo){
                        opt = opt+"<option value="+vo.st_id+">"+vo.st_name+"</option>";
                    });
                    $("#msg1").empty();
                    $("#msg1").append('<option value="">---- 请选择产品分类 ----</option>');
                    $("#msg1").append(opt);
                    //22
                    var opt = '';
                    $.each(res.msg2,function(key,vo){
                        opt = opt+"<option value="+vo.spp_id+">"+vo.spp_name+"</option>";
                    });
                    $("#msg2").empty();
                    $("#msg2").append('<option value="">---- 请选择产品品牌 ----</option>');
                    $("#msg2").append(opt);
                    //33
                    var opt = '';
                    $.each(res.msg3,function(key,vo){
                        opt = opt+"<option value="+vo.sstyle_id+">"+vo.sstyle_name+"</option>";
                    });
                    $("#msg3").empty();
                    $("#msg3").append('<option value="">---- 请选择产品风格 ----</option>');
                    $("#msg3").append(opt);
                    form.render('select');
                }
            })
        });
    });
</script>

</body>
</html>
